#ifndef Encryptionpage_H
#define Encryptionpage_H

#include <QFrame>
#include <DLineEdit>
#include <DTextEdit>
#include <DPushButton>
#include <DToast>

#include <dgraphicsclipeffect.h>
#include <dgraphicsgloweffect.h>
#include <dblureffectwidget.h>
#include "encrythionimpl.h"

DWIDGET_USE_NAMESPACE

class Encryptionpage : public QFrame
{
    Q_OBJECT
public:
    explicit Encryptionpage(QWidget *parent = nullptr);

protected:
    void paintEvent(QPaintEvent *event);
    void showEvent(QShowEvent *event);

private:
    DToast *m_toast;
    EncrythionImpl m_encryImpl;
    std::string m_desEncryptText;
    std::string m_desDecryptText;

    QString m_rsaEncryptText2;

    std::string m_key[2];
    std::string m_rsaEncryptText;
    std::string m_rsaDecryptText;

    DLineEdit *m_lineEdit;
    DTextEdit *m_encryptedEdit; //加密文本输入框
    DTextEdit *m_decryptedEdit; //解密文本框
    DTextEdit *m_hexEdit; //十六进制摘要串
    DTextEdit *m_rsaPublicKeyEdit; //解密文本框
    DTextEdit *m_rsaPrivateEdit; //解密文本框
    DPushButton *m_btnMD5;
    DPushButton *m_btnSHA;
    DPushButton *m_btnEncryptDES;
    DPushButton *m_btnDecryptDes;

    DPushButton *m_btnRSAPruKey;
    DPushButton *m_btnEncryptRSA;
    DPushButton *m_btnDecryptRSA;
    DPushButton *m_btnClean;

    void initUI();
    void initConnections();
    void MD5ConvertText();
    void SHA256ConvertText();

    //DES相关
    void DESEncryptText();
    void DESDecryptText();

    //RSA相关
    void GenerateRSAKey();
    void RSAEncryptText();
    void RSADecryptText();
};

#endif // Encryptionpage_H
